<HTML><HEAD><TITLE>underlying_graph(+DirectedGraph, ?UndirectedGraph)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(grasper)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>underlying_graph(+DirectedGraph, ?UndirectedGraph)</H1>
Obtains an underlying graph of a given directed graph.
<DL>
<DT><EM>DirectedGraph</EM></DT>
<DD>A directed graph.
</DD>
<DT><EM>UndirectedGraph</EM></DT>
<DD>The underlying undirected graph of DirectedGraph.
</DD>
</DL>
<H2>Description</H2>
Obtains an underlying graph of a given directed graph.
<H3>Fail Conditions</H3>
Fails 
			 if DirectedGraph is not a directed graph variable or
			 if DirectedGraph can not be contrained to have UndirectedGraph as its underlying graph (UndirectedGraph is a undirected graph variable).
			
<H2>Examples</H2>
<PRE>
?- underlying_graph(DG,UG).
No.

?- V`::[]..[1,2,3], DE`::[[3,1]]..[[1,2],[2,3],[3,1]], UE`::[]..[[1,2],[2,1],[2,3],[3,2]], dirgraph(DG,V,DE), undirgraph(UG,V,UE), underlying_graph(DG,UG).
No.

?- V`::[]..[1,2,3], DE`::[[3,1]]..[[1,2],[2,3],[3,1]], dirgraph(DG,V,DE), underlying_graph(DG,UG), graph_labeling(DG).
V = [1, 3]
DE = [[3, 1]]
DG = dirgraph([1, 3], [[3, 1]])
UG = undirgraph([1, 3], [[1, 3], [3, 1]])
Yes ? ;

V = [1, 2, 3]
DE = [[3, 1]]
DG = dirgraph([1, 2, 3], [[3, 1]])
UG = undirgraph([1, 2, 3], [[1, 3], [3, 1]])
Yes ? ;

V = [1, 2, 3]
DE = [[2, 3], [3, 1]]
DG = dirgraph([1, 2, 3], [[2, 3], [3, 1]])
UG = undirgraph([1, 2, 3], [[1, 3], [2, 3], [3, 1], [3, 2]])
Yes ? ;

V = [1, 2, 3]
DE = [[1, 2], [3, 1]]
DG = dirgraph([1, 2, 3], [[1, 2], [3, 1]])
UG = undirgraph([1, 2, 3], [[1, 2], [1, 3], [2, 1], [3, 1]])
Yes ? ;

V = [1, 2, 3]
DE = [[1, 2], [2, 3], [3, 1]]
DG = dirgraph([1, 2, 3], [[1, 2], [2, 3], [3, 1]])
UG = undirgraph([1, 2, 3], [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]])
Yes

?- V`::[]..[1,2,3], DE`::[]..[[1,2],[2,3],[3,1]], UE`::[]..[[1,2],[2,1],[2,3],[3,2]], dirgraph(DG,V,DE), undirgraph(UG,V,UE), underlying_graph(DG,UG), size(DG,Size), Size #&gt; 0, graph_labeling(DG).
V = [1, 2]
DE = [[1, 2]]
UE = [[1, 2], [2, 1]]
DG = dirgraph([1, 2], [[1, 2]])
UG = undirgraph([1, 2], [[1, 2], [2, 1]])
Size = 1
Yes ? ;

V = [1, 2, 3]
DE = [[2, 3]]
UE = [[2, 3], [3, 2]]
DG = dirgraph([1, 2, 3], [[2, 3]])
UG = undirgraph([1, 2, 3], [[2, 3], [3, 2]])
Size = 1
Yes ? ;

V = [1, 2, 3]
DE = [[1, 2]]
UE = [[1, 2], [2, 1]]
DG = dirgraph([1, 2, 3], [[1, 2]])
UG = undirgraph([1, 2, 3], [[1, 2], [2, 1]])
Size = 1
Yes ? ;

V = [1, 2, 3]
DE = [[1, 2], [2, 3]]
UE = [[1, 2], [2, 1], [2, 3], [3, 2]]
DG = dirgraph([1, 2, 3], [[1, 2], [2, 3]])
UG = undirgraph([1, 2, 3], [[1, 2], [2, 1], [2, 3], [3, 2]])
Size = 2
Yes
			</PRE>

</BODY></HTML>
